package com.datas.controller.api;

import com.datas.service.GuanlianService;
import com.datas.service.api.ApiPermissionService;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by jige0727 on 2017/5/30.
 */
@Controller
public class ApiPermissionController {
    @Autowired
    GuanlianService guanlianService;
    @Autowired
    ApiPermissionService apiPermissionService;
    //TODO 校验 appkey
    static String appkey = "0cb11943b1e14163a0948acb15245e33";

    @ResponseBody
    @RequestMapping(value = "/pageresources/bycode", produces = "application/json;charset=UTF-8")
    public String userinfo(String roleCode) {
        JSONArray res = new JSONArray(apiPermissionService.getPageresourcesByRoleCode(roleCode));
        return res.toString();
    }

}
